package com.atguigu.flink.datastreamapi.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Smexy on 2022/12/13
 *
 */
public class Demo2_Test
{
    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

        //基于一个集合Collection获取一个Source
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);

        DataStreamSource<Integer> streamSource = env.fromCollection(list);

        //基于元素获取Source
        // DataStreamSource<Integer> streamSource = env.fromElements(1, 2, 3, 4, 5, 6, 7);

        streamSource.print();

        env.execute();

    }
}
